<?php

/**
 * NOTICE OF LICENSE
 *
 * THIS SOURCE FILE IS PART OF EVEBIT'S PRIVATE PROJECT.
 * 
 * DO NOT USE THIS FILE IN OTHER PLACE.
 *
 * @package   App_Sample
 * @author    Cheng Wei <berlios.o@gmail.com>
 * @version   $$Id: GetSortClass.php 130 2011-03-18 03:10:02Z cheng.wei $$
 * @copyright Copyright (c) 2008 Evebit Inc. China (http://www.evebit.com)
 */

/**
 * Get Revage rate and get rate count
 * 
 * @package   App_Sample
 * @author    Chang ZhenHua <chang.zhenhua@gmail.com>
 * @version   $$Id: GetSortClass.php 130 2011-03-18 03:10:02Z cheng.wei $$
 */
class Evebit_View_Helper_GetSightsSliderImage extends Zend_View_Helper_Abstract {
	protected $firstload = false;	
	
    function getSightsSliderImage($gallaryitems=null,$getImageMethodName='getAUrl',$w=563,$h=257) {
    	//load script
    	if (!$this->firstload) {
    		//load script and css start
    		$this->view->headScript()->prependFile($this->view->baseUrl("media/js/slider.js"));
    		//load script and css end
    		$this->firstload = true;
    	}
    	
    	$style="width:".$w."px;height:".$h."px;";
    	echo '<div class="slider_content">
				  <div class="ad" style="'.$style.'">
				    <ul class="slider" >';
    	$num = 0;
    	
    	if ($gallaryitems == null) {
    		echo '<li><a href="#"><img src="'.$this->view->baseUrl("/media/images/buttom_0.jpg").'" style="'.$style.'"/></a></li>';
	    	echo '<li><a href="#"><img src="'.$this->view->baseUrl("/media/images/buttom_1.jpg").'" style="'.$style.'"/></a></li>';
	    	echo '<li><a href="#"><img src="'.$this->view->baseUrl("/media/images/buttom_2.jpg").'" style="'.$style.'"/></a></li>';
	    	echo '<li><a href="#"><img src="'.$this->view->baseUrl("/media/images/buttom_3.jpg").'" style="'.$style.'"/></a></li>';
    	} else {
    		foreach ($gallaryitems as $item) {
	    		echo '<li><a href="'.$this->view->baseUrl().'/sights/'.$item->getTargetUrl().'"><img src="'.$this->view->baseUrl("/media/".$item->$getImageMethodName()).'" style="'.$style.'"/></a></li>';
	    		$num++;
    	    }
    	}
    	
    	echo '</ul><ul class="num" >';
    	
        if ($gallaryitems == null) {
    		echo '<li>1</li>';
			echo '<li>2</li>';
			echo '<li>3</li>';
			echo '<li>4</li>';
    	} else {
	    	for ($i=0;$i<$num;$i++) {
				echo '<li>'.($i+1).'</li>';
			}
    	}
		echo '</ul></div></div>';
    	
		/*if ($ratetype == 'default') {
			return 5;
		} else if ($ratetype == 'average') {
			$comment = new Default_Model_Entity_Comment();
			$rates=$comment->getAvgRate($type,$info_id);
			foreach ($rates as $rate) {
				if($rate->getInfoId()==$info_id){
					$rateScore=$rate->getRatecore();
					return floor($rate->getRatecore());
				}
			}
			return 0;
		} else if ($ratetype == 'userrate') {
			$comment = new Default_Model_Entity_Comment();
			$item=$comment->getUserRate($user_id,$type,$info_id,$comment_id);
			if (!$item) {
				return -1;
			} else {
				return floor($item['rate']);
			}
		}else {
			return 0;
		}*/
	}
	
}